{
  LW Preview -- LightWave Preview Services

  The Preview Functions global is the plug-in API for
  LightWave®'s VIPER (Versatile Interactive Preview Render) window.
  VIPER allows users to preview the effects of shader, environment, volumetric,
  pixel filter and image filter plug-ins.
  It uses image buffers from the most recent test render to generate
  a reduced-size rendering of the scene, and it can composite this with your
  plug-in's output while the user changes your parameters.

  Based on lwpreview.h which is:
  Copyright 2001, NewTek, Inc.
}

{
  Copyright 2012, Jameel Halabi

  This unit is part of the BlaiseWave wrapper,
  which is licensed under the BSD 2-Clause license (see licenses/license.txt).
}

unit LW_Preview;

{$mode objfpc}{$H+}

interface

uses
  LW_Types   ,
  LW_Image   ,
  LW_Txtr    ;

const
  LWPREVIEWFUNCS_GLOBAL = 'Preview Functions' ;

type
  PPvSample = ^TPvSample ;
  TPvSample = record
    X      ,
    Y      : Integer ;
    RGBAZ  : array [0..4] of Single ;
    MP     : TLWMicropol ;
  end;

  TClickfunc    = function
                  (       Count        : Integer        ;
                          UserData     : Pointer        ;
                          Pixel        : PPvSample      ) : Integer ;

  TOptionsfunc  = procedure
                  (       Option       : Integer        ;
                          UserData     : Pointer        ) ;

  TClosefunc    = procedure
                  (       UserData     : Pointer        ) ;

  TInitfunc     = function
                  (       RenderData   : Pointer        ;
                          Manual       : Integer        ) : Integer ;
  TCleanUpfunc  = procedure
                  (       RenderData   : Pointer        ) ;

  TEvaluatefunc = function
                  (       RenderData   : Pointer        ;
                          W            ,
                          H            : Integer        ;
                          Pixel        : PPvSample      ) : Integer ;

  TPresetFunc   = procedure
                  (       UserData     : Pointer        ;
                          Img          : PLWImage       ) ;

  PPvContext =^TPvContext ;
  TPvContext = record end;

  PLWPreviewFuncs = ^TLWPreviewFuncs ;
  TLWPreviewFuncs = record
    Subscribe     : function
                    (       Title        : PChar            ;
                            UserData     : Pointer          ;
                            CloseFunc    : TClosefunc       ) : PPvContext ;
    Unsubscribe   : procedure
                    (       Context      : PPvContext       ) ;

    Open          : procedure
                    (       Context      : PPvContext       ) ;
    Close         : procedure
                    ( const Void                            ) ;
    IsOpen        : function
                    ( const Void                            ) : Integer    ;

    SetContext    : procedure
                    (       Context      : PPvContext       ) ;
    SetClick      : procedure
                    (       Clickfunc    : TClickfunc       ;
                            Context      : PPvContext       ) ;
    SetRender     : procedure
                    (       Context      : PPvContext       ;
                            RenderData   : Pointer          ;
                            InitFunc     : TInitfunc        ;
                            CleanUpfunc  : TCleanUpfunc     ;
                            Evaluatefunc : TEvaluatefunc    ) ;
    SetOptions    : procedure
                    (       Context      : PPvContext       ;
                            List         : PPChar           ;
                            Optionsfunc  : TOptionsfunc     ;
                            Selection    : Integer          ) ;

    StartRender   : procedure
                    (       Context      : PPvContext       ) ;
    StopRender    : procedure
                    (       Context      : PPvContext       ) ;

    GetPixel      : procedure
                    (       Pixel        : PPvSample        ) ;
    GetBitmap     : function
                    (       Width        ,
                            Height       : Integer          ) : PLWImage ;
    GetCamera     : function
                    (       Pos          : array {[0..2]} of Double ;
                            Rot          : array {[0..2]} of Double ;
                            ZoomFactor   : Double           ) : PLWItem  ;
    GetView       : procedure
                    (       Width        ,
                            Height       : Integer          ;
                            PixelAspect  : Double           ) ;
    SetPreset     : procedure
                    (       Context      : PPvContext       ;
                            Presetfunc   : TPresetFunc      ) ;
  end;

implementation

end.

